package com.Feifan.A;

public class override_equals {
    String name;

    @Override
    public boolean equals(Object obj) {
        if(this==obj){//比较的是地址
            return true;
        }
        if(obj==null){//如果有一个为空
            return false;
        }
        if(this.getClass()!=obj.getClass()){//如果运行时两个对象来自不一样的种类
            return false;
        }
        override_equals that=(override_equals) obj;
        return this.name.equals(that.name)?this.name.equals(that.name):false;
    }
}
